@(veiculos: List[Veiculo], inserirForm: Form[Veiculo], emEdicao: Boolean, modelos: List[Modelo])


@import helper._


@implicitFieldConstructor = @{ FieldConstructor(twitterBootstrapInput.f) }


@main("Veículos") { 
    <table class="table table-bordered table-condensed">
    	<thead>
    	<tr>
    		<th>Ano</th>
    		<th>Placa</th>
    		<th>Modelo</th>
    		<th>Cilindradas</th>
    		<th>Chassi</th>
    	</tr>
<thead>
<tbody>
        @for(v <- veiculos) {
        <tr>
            <td>@v.anoFabricacao</td>
            <td>@v.placa</td>
            <td>@v.modelo.descricao</td>
            <td>@v.cilindradas</td>
            <td>@v.chassi</td>
      <td>
		<a href="@routes.Veiculos.editar(v.id)" class="btn btn-mini">
		  <i class="icon-edit"></i> Editar
		</a>
		<a href="@routes.Veiculos.remover(v.id)" class="btn btn-danger btn-mini">
		  <i class="icon-trash icon-white"></i> Remover
		</a>
      </td>
        </tr>
        }
        </tbody>
    </table>
        
    @form(routes.Veiculos.salvar(), 'class -> "form-horizontal") {
    <fieldset>
    <legend>
      @if(emEdicao){Editar Veículo} else {Novo Veículo}
    </legend>
   		@inputText(inserirForm("anoFabricacao"), '_label -> "Ano")
   		@inputText(inserirForm("placa"), '_label -> "Placa")
   		@inputText(inserirForm("cilindradas"), '_label -> "Cilindradas")
   		@inputText(inserirForm("chassi"), '_label -> "Chassi")
		@select(
		  inserirForm("modelo.id"),
		  options = modelos.map{m => (m.id.toString, m.descricao)},
		  '_label -> "Modelo"
		)
   		<input type="hidden" name="id" value="@inserirForm("id").value">
<div class="control-group">
    <div class="controls">   		
          <input type="submit" class="btn primary" value="Salvar" />
        </div>
       </div>
 </fieldset>
    }
    
}